<form class="layui-form seller-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline" style="width: 150px;">
            <select name="type" lay-verify="" >
                <option value="" >所有</option>
                <option value="add_card_balance" >增加卡余额</option>
                <option value="deduct_card_balance" >减少卡余额</option>
                <option value="card_del" >注销卡</option>
            </select>
        </div>
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="user_name" lay-verify="title" placeholder="Input User Name" autocomplete="off"
                   class="layui-input" style="width: 200px;">
        </div>
        <div class="layui-inline" style="padding-left: 5px;">
            <input type="text" name="card_num" lay-verify="title" placeholder="Input Card Num" autocomplete="off"
                   class="layui-input" style="width: 200px;">
        </div>

        <div class="layui-inline">
            <input type="text" name="datetime" id="datetime" placeholder="start_time _ end_time"
                   autocomplete="off" class="layui-input" style="width: 200px;">
        </div>
        <div class="layui-inline">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*"><i class="iconfont icon-chaxun"></i>Search</button>
            </div>
        </div>
    </div>
</form>
<div class="table-body">
    <table id="balanceTable" lay-filter="balanceTable"></table>
</div>
<script>
    layui.use(['form', 'laydate', 'table',], function () {
        var laydate = layui.laydate,
            form = layui.form,
            table = layui.table; //表格
        //时间插件
        laydate.render({
            elem: '#datetime',
            range: '_',
            format: 'yyyy-MM-dd'
        });
        table.render({
            elem: '#balanceTable',
            height: 'full-99',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            url: "{:url('userAction')}",
            id: 'balanceTable',
            cols: [[
                { type: 'numbers'},
                { field: 'username',  align: 'left', title: 'UserName',width: 180},
                { field: 'type',  align: 'left', title: 'type',width: 150},
                { field: 'card_num',  align: 'left', title: 'Card Num',width: 200},
                { field: 'amount', title: '操作金额', align:"right",
                    style:'color:#FF5722;font-weight:bold' , width:130,totalRow: true
                },
                { field: 'data_param',  align: 'center', title: '错误信息',width: 200},
                { field: 'desc',  align: 'center', title: '详细信息',width: 300},
                { align: 'center', title: '是否修复',width:100,
                    templet: function (d) {
                        const rep = d.is_rep;
                        if(rep == 1){
                            return '<font style="color:green">已修复</font>';
                        }else{
                            return '--';
                        }
                    }
                },
                { align: 'center', title: 'CreateTime',width:200,
                    templet: function (d) {
                        return layui.util.toDateString(d.ctime * 1000, "yyyy-MM-dd HH:mm:ss");
                    }
                }
            ]],
            page: true,
            limit: 20,
            limits: [20, 50, 100],
        });
        form.on('submit(*)', function (data) {
            layui.table.reload('balanceTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>